package com.company.project.upm.job;


import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;


/**
 * @Description DemoJob
 * @Author zhongbo.yu
 * @Date 2021/12/28
 */
@Component
@Slf4j
public class DemoJob {

    /**
     * 定时
     */
    @XxlJob("xxxJobHandler")
    public ReturnT<String> xxxJobHandler(String param) {
        try {
            log.info("Job Start param:" + param);
            long time = System.currentTimeMillis();
            XxlJobLogger.log("开始");


            XxlJobLogger.log("结束,耗时：" + (System.currentTimeMillis() - time));
            log.info("Job End Dto:" + param);
            return ReturnT.SUCCESS;
        } catch (Exception e) {
            log.error("xxxJobHandler-error", e);
            return ReturnT.FAIL;
        }
    }
}
